package com.hydra.auth.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.hydra.base.entity.UserTimeEntity;
import com.hydra.base.utils.SnowIdUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * ID队列
 */
@ToString(callSuper = true)
@TableName(value = "tb_sys_id_generator")
public class IdGenerator extends UserTimeEntity {

	/**
	 * 自增长的值
	 */
	@Getter
	@Setter
	private Long value;

	/**
	 * 队列名称
	 */
	@Getter
	@Setter
	private String name;

	public void initEntity(){
		this.createTime = LocalDateTime.now();
		this.updateTime = LocalDateTime.now();
		//生成id
		this.id = SnowIdUtil.getInstance().nextId();
	}

}
